﻿using QDPay.Bus;
using QDPay.Bus.domain.pay;
using QDPay.WxSdk;
using QDPay.WxSdk.Domain.pay;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;

namespace QDPay.Test
{


    class Program
    {
        static void Main(string[] args)
        {
            var pay = new QDPays();
            var createUid = 1414386;

            FaceSDK.InitWxPayFace();

            var rawData = FaceSDK.GetRawData();
            var auth = pay.GetFaceAuthhInfo(createUid, rawData);

            var out_trade_no = DateTime.Now.ToString("yyMMddHHmmss");

            Echo(string.Format("\r\nrawData:\r\n{0}", rawData));
            var codeInput = new FaceCodeInput()
            {
                appid = "wx5a48f9c519e4452d",
                mch_id = "1501045831",
                sub_mch_id = "1504789131",
                sub_appid = "wx9ec3c9261a80753d",
                total_fee = 1,
                out_trade_no = out_trade_no,
                telephone = "15107555830",
                store_id = auth.store_id,
                authinfo = auth.authinfo,
                face_authtype = "FACEPAY"
            };

            var faceCode = FaceSDK.GetFaceCode(codeInput);
            Echo(string.Format("\r\nfaceCode:\r\n{0}", faceCode));
            FaceSDK.ReleaseWxPayFace();
        }

        static void Echo(string msg)
        {
            Console.WriteLine(msg);
        }
    }
}
